const log4js = require("log4js");

log4js.configure({
  appenders: {
    out: {
      type: "stdout",
      layout: {
        type: "pattern",
        pattern: "%d{yyyy-MM-dd hh:mm:ss} -- [%p] -- %m%n",
      },
    },
    app: {
      type: "file",
      filename: "logs/application.log",
      maxLogSize: 10485760,
      backups: 3,
      compress: true,
    },
  },
  categories: {
    default: { appenders: ["out", "app"], level: "info" },
  },
});

const logger = log4js.getLogger();

module.exports = logger;
